package com.sky.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface VisaTemplateMapper {

    @Select("SELECT template_id FROM visa_product_template WHERE product_id = #{productId}")
    List<Long> findTemplateIdsByProductId(Long productId);

    @Select("SELECT DISTINCT ft.field_group FROM visa_product_template vpt " +
            "LEFT JOIN form_template ft ON vpt.template_id = ft.id " +
            "WHERE vpt.product_id = #{productId} AND ft.field_group IS NOT NULL AND ft.field_group != ''")
    List<String> findTemplateUserTypesByProductId(Long productId);
}